package com.jeespring.concurrency.sigleton;

/**
 * 饿汉模式
 */
public class SigletonExample6 {

    // 私有构造函数
    private SigletonExample6(){

    }
    //单例对象
    private static SigletonExample6 instance = null;

    static {
        instance = new SigletonExample6();
    }

    //静态工厂方法
    public static SigletonExample6 getInstance(){
        return instance;
    }

    public static void main(String[] args) {
        System.out.println(getInstance());
        System.out.println(getInstance());

    }
}
